package presentation;

import java.awt.Dimension;
import java.awt.Point;

import javax.swing.JPanel;

import controle.CCarte;
import controle.CTasDeCartesColorees;

public class PTasDeCartesColorees extends JPanel implements IPTas {
	CTasDeCartesColorees controle;

	public PTasDeCartesColorees(CTasDeCartesColorees cTasDeCartes) {
		controle=cTasDeCartes;
		this.setLayout(null);
		Dimension dim = new Dimension(72, 96);
		this.setPreferredSize(dim);
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public void depiler() {
		// TODO Auto-generated method stub
		 try {
				this.remove((PCarte)((CCarte) controle.getSommet()).getPresentation());
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}

	@Override
	public void empiler(IPCarte carte) {
		// TODO Auto-generated method stub
		this.add((PCarte) carte,0);
		((PCarte)carte).setLocation(0, 0);
		
	}

	@Override
	public PCarte getBase() {
		// TODO Auto-generated method stub
		try {
			return (PCarte) ((CCarte) controle.getBase()).getPresentation();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public PCarte getCarte(int n) {
		// TODO Auto-generated method stub
		try {
			return (PCarte) ((CCarte) controle.getCarte(n)).getPresentation();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public PCarte getSommet() {
		// TODO Auto-generated method stub
		try {
			return (PCarte) ((CCarte) controle.getSommet()).getPresentation();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public int getNombre() {
		return this.controle.getNombre();
	}


}
